//
//  ViewController.m
//  NhomThuy02
//
//  Created by Lam Quoc on 2/1/15.
//  Copyright (c) 2015 LamQuoc. All rights reserved.
//

#import "ViewController.h"
#import "NhacVietViewController.h"
#import "NhacNgoaiViewController.h"
#import "LoveSongViewController.h"
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [UINavigationBar appearance];
    [self.navigationController.navigationBar setTintColor:[UIColor whiteColor]];
    [self.navigationController.navigationBar setBarTintColor:[UIColor greenLightColor]];
    self.navigationItem.titleView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"img_logo.png"]];
    self.overlay = [[GHContextMenuView alloc] init];
    self.overlay.dataSource = self;
    self.overlay.delegate = self;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
#pragma mark - Menu
- (NSInteger) numberOfMenuItems
{
    return 3;
}

-(UIImage*) imageForItemAtIndex:(NSInteger)index
{
    NSString* imageName = nil;
    switch (index) {
        case 0:
            imageName = @"icon_tabbar_vietnam_normal.png";
            break;
        case 1:
            imageName = @"icon_tabbar_internatioal_normal.png";
            break;
        case 2:
            imageName = @"icon_tabbar_like_normal.png";
            break;
            
        default:
            break;
    }
    return [UIImage imageNamed:imageName];
}

- (void) didSelectItemAtIndex:(NSInteger)selectedIndex forMenuAtPoint:(CGPoint)point
{
    
    NSString* storyboardID = nil;
    UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"Main" bundle:[NSBundle mainBundle]];
    
    switch (selectedIndex) {
        case 0:
            storyboardID = @"NhacVietStoryboard";
            break;
        case 1:
            storyboardID = @"NhacNgoaiStoryboard";
            break;
        case 2:
            storyboardID = @"YeuThichStoryboard";
            break;
            
        default:
            break;
    }
    
    UINavigationController *n = self.navigationController;
    if (![n.restorationIdentifier isEqualToString:storyboardID]) {
        UINavigationController *navigationController;
        navigationController = [storyboard instantiateViewControllerWithIdentifier:storyboardID];
        [self presentViewController:navigationController animated:YES completion:^{
            
        }];
        [self dismissViewControllerAnimated:YES completion:^{
            
        }];
    }
}

@end
